package com.mymall.basic.config;

import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.ftp.Ftp;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.io.File;
import java.io.IOException;


@Data
@Configuration
public class FtpClientUtil {


    @Value("${mymall.ftp.host}")
    private String host;
    @Value("${mymall.ftp.port}")
    private int port;
    @Value("${mymall.ftp.user}")
    private String user;
    @Value("${mymall.ftp.password}")
    private String password;

    public Ftp getFtp() {
        return new Ftp(host, port, user, password);
    }


    public static void main(String[] args) throws IOException {
//        Ftp ftp = new Ftp("192.168.33.10", 21, "davion", "davion");
//
//        ftp.upload("/upload/"+DateUtil.today()+"/",new File("C:\\Users\\Administrator\\Pictures\\01.jpg"));
//        ftp.close();

        System.out.println(DateUtil.today().replace("-", "/"));

    }

}
